Zadig 文档
Zadig
教程
博客
论坛
关于
中文英文
Zadig
教程
博客
论坛
关于
Zadig v4.2
Loading...
     编辑文档
     反馈问题
     社区讨论

    本页导航

    Based on Zadig + Ingress to Achieve a Single Application Grayscale Release

    This article details the basic principles of how to combine Zadig and Ingress to achieve a stable production release, and demonstrates the specific operations in Zadig through practical examples.

    # Basic Principles

    Note: The production version and the new version (blue environment) are managed in the same production environment in Zadig.

    How It Works:

    1. Deploy the blue environment: Copy the current workload, set a new image, and create a blue service pointing to it.
    2. Switch part of the production traffic to the blue environment: Create a ingress-blue of the same Host based on the original ingress service pointing blue service and turn on nginx.ingress.kubernetes.io/canary: "true" , and modify the weight configuration nginx. ingress.kubernetes.io/canary-weight:50 according to the actual situation.
    3. Blue-Green Release: Set the production workload image to the new image.
    4. Cut off blue environment traffic: Modify the ingress-blue configuration to nginx.ingress.kubernetes.io/canary: "false".
    5. Blue-Green Cleanup: After the workflow is executed, regardless of the final state, delete the blue service and blue workload.

    Below, we will detail how to combine Ingress in Zadig to achieve a safe, stable, and efficient production release.

    # Project Preparation

    # Create a Project

    Create a project and configure production services a, b, and c. This example's source code and service YAML configuration can be referenced from the project(opens new window).

    ingress-gray

    Add ingress configuration to the service YAML configuration:

    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: a-ingress
      annotations:
        nginx.ingress.kubernetes.io/rewrite-target: /
    spec:
      ingressClassName: koderover
      rules:
      - host: a-prod.edu.koderover.com
        http:
          paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: a
                port:
                  number: 8080
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19

    # Environment Configuration

    1. Create a production environment prod > Manage Services > Add Service, and select a, b, and c.

    ingress-gray

    1. Add ingress-blue to prepare for production release configuration.

    The ingress-blue configuration for service a is as follows:

    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: a-ingress-blue
      annotations:
        nginx.ingress.kubernetes.io/rewrite-target: /
        nginx.ingress.kubernetes.io/canary: "false"
        nginx.ingress.kubernetes.io/canary-weight: "0"
    spec:
      ingressClassName: koderover
      rules:
      - host: a-prod.edu.koderover.com  #Ensure the host is consistent with the one used in the ingress configuration of service a
        http:
          paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: a-blue #Point to the new version of service a
                port:
                  number: 8080
    
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22

    # Configure the workflow:

    Create a new workflow > Select the "Blue-Green Release" template > Configure the workflow. The workflow contains the following steps and specific configurations:

    1. Deploy Blue and Green Environment: Use the "Deploy Blue and Green Environment" task to add service a.

    ingress-gray

    1. 导 50 流量 : Use "Update K8s YAML Task", select ingress-blue Configuration, and set nginx.ingress.kubernetes.io/canary: "true" and nginx.ingress.kubernetes.io/canary-weight: "50" .

    ingress-gray

    1. Check New Version: Use the "General Task" or "Test" task to configure the corresponding check scripts and perform automated testing for the new version.
    2. Approval: Enable "Manual Approval" in the production upgrade stage to ensure the reliability of the release.

    ingress-gray

    1. Production Upgrade: Use the "Blue-Green Release" task, ensuring the "Deploy Blue-Green Environment" task is correctly selected in the configuration.

    ingress-gray

    1. Cut Off Traffic: Use the "Update K8s YAML Task," select the ingress-blue configuration, and set nginx.ingress.kubernetes.io/canary: "false" and nginx.ingress.kubernetes.io/canary-weight: "0".

    ingress-gray

    # Execute Production Release

    # Execute the Workflow

    Perform the workflow with the following configuration:

    • Deploy the blue environment: Select myapp-1(a) for the service component and choose the image to be published
    • Divert 50% Traffic: Select the ingress-blue resource
    • Cut Off Traffic: Select the ingress-blue resource

    When the workflow reaches the pending approval state, the following operations have been completed: automatic deployment of the blue environment, diversion of 50% of traffic to the new version, and automated testing and verification of the production environment. Next, we will use Zadig's environment capabilities to verify whether the traffic distribution meets expectations.

    # Effect Verification

    During the release process, there are two sets of deployments and services for service a, one for the production version and one for the new version. At this time, 50% of the traffic is expected to go to the production version and 50% to the new version.

    Execute the following request to view the service logs and verify the traffic distribution results.

    for i in $(seq 1 100); do curl -X PUT http://a-prod.edu.koderover.com/api/v1/count; done
    
    1

    The number of requests entering the production version and the new version of service a:

    After manual approval, the workflow will automatically update the production environment image, switch all traffic back to production, and finally clean up all temporary resources.

    At this point, a complete production release has been completed. In actual use, you can control the timing of the new version's release during the manual approval stage using monitoring data to ensure that production releases occur during low-usage periods, reducing the impact on users.

    ← MSE Full-Link Grayscale ReleaseWorkflow Pre-Approval→

    资源
    教程
    论坛
    博客
    公司
    关于
    客户故事
    加入我们
    联系我们
    微信扫一扫
    hello@koderover.com

    © 2026 筑栈(上海)信息技术有限公司 沪 ICP 备 19000177 号 - 1

    •  跟随系统
    •  浅色模式
    •  深色模式
    •  阅读模式